package com.http;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

public class ImageHttpUtil {

	public final static String baseImageUploadURL = "http://rs88881234.com/zimg/upload";
	//public final static String baseImageUploadURL = "http://rs88881234.com:4869/upload";// 非nginx
	private static AsyncHttpClient client = new AsyncHttpClient(); // 实例话对象
	static {
		client.setTimeout(8000); // 设置链接超时，如果不设置，默认为10s
	}

	public static void rawpost(RequestParams params, String contentType, AsyncHttpResponseHandler res) // 提交数据，会返回byte数据
	{
		client.addHeader("Content-Type", contentType.toLowerCase());
		client.post(baseImageUploadURL, params, res);
	}

	public static void rawpost(RequestParams params, AsyncHttpResponseHandler res) // 提交数据，会返回byte数据
	{
		client.post(baseImageUploadURL, params, res);
	}

	public static AsyncHttpClient getClient() {
		return client;
	}

}